package com.example.myfirstgame.helper;

import com.example.myfirstgame.resources.Colors;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;

public class RasterPoint {

	private Coordinate mCoordinate;
	private String mWidthID;
	private String mHeightID;
	// StandardValue
	private int mRasterSize = 5;
	private Rect mDrawingRect;
	private Paint mPaint;

	public RasterPoint(Coordinate pCoordinate, String pWidthID, String pHeightID) {
		mCoordinate = pCoordinate;
		mWidthID = pWidthID;
		mHeightID = pHeightID;
		mDrawingRect = null;
		mPaint = new Paint();
		mPaint.setColor(Colors.LIGHT_GREEN);
		mPaint.setStrokeWidth(0);        
		mPaint.setStyle(Paint.Style.STROKE);       
	}

	public void setRasterSize(int pRasterSize) {
		mRasterSize = pRasterSize;
	}
	
	public int getRasterSize(){
		return mRasterSize;
	}

	public String getCellIDWidth() {
		return mWidthID;
	}

	public String getCellIDHeight() {
		return mHeightID;
	}

	public String getID() {
		String lRes = "";
		lRes = mHeightID + ", " + mWidthID;
		return lRes;
	}

	public Coordinate getCoordinate() {
		return mCoordinate;
	}

	public void draw(Canvas pCanvas) {
		pCanvas.drawRect(buildRect(),mPaint);
	}

	private Rect buildRect() {
		if (mDrawingRect == null) {
			Rect pRect = new Rect((int) mCoordinate.getX(),
					(int) mCoordinate.getY(), (int) mCoordinate.getX()
							+ mRasterSize, (int) mCoordinate.getY()
							+ mRasterSize);
			mDrawingRect = pRect;
		}
		return mDrawingRect;
	}
}
